package redora.rdo.test.rdo.service;

import java.util.Set;
import redora.rdo.api.BusinessRuleViolation;
import redora.rdo.exceptions.BusinessRuleViolationException;
import redora.rdo.test.rdo.service.base.JUnitNtoMBusinessRulesBase;
import redora.rdo.test.rdo.model.JUnitNtoM;
import redora.rdo.test.rdo.service.JUnitNtoMUtil;

public class JUnitNtoMBusinessRules extends JUnitNtoMBusinessRulesBase {
	public JUnitNtoMBusinessRules(JUnitNtoMUtil util) {
		super(util);
	}
	
	@Override
	public Set<BusinessRuleViolation> onInsert(JUnitNtoM pojo) throws BusinessRuleViolationException {
		Set<BusinessRuleViolation> retval = super.onInsert(pojo);
		
		return retval;
	}
	
	@Override
	public Set<BusinessRuleViolation> onUpdate(JUnitNtoM pojo) throws BusinessRuleViolationException {
		Set<BusinessRuleViolation> retval = super.onUpdate(pojo);
		
		//for example check if the updateDate is newer then the last updateDate
		//if (pojo.dirty.containsKey(JUnitNtoMFields.updateDate) {
		//  if (pojo.dirty.get(JUnitNtoMFields.updateDate) != null && pojo.dirty.get(JUnitNtoMFields.updateDate).compareTo(pojo.getUpdateDate() > 0) {
		//    retval.add(new BusinessRuleViolation(
		//		JUnitNtoM, JUnitNtoMFields.updateDate, BR_1, Action.Update));
		//  }
		//}
		return retval;
	}
	
	@Override
	public Set<BusinessRuleViolation> onDelete(JUnitNtoM pojo) throws BusinessRuleViolationException {
		Set<BusinessRuleViolation> retval = super.onDelete(pojo);
		
		return retval;
	}
}
